const express = require('express');
const router = express.Router()
const { userSubmitOrder, userPayOrder, userOrderRecords, userCancelOrder, userConfirmTravel } = require('../../controller/web/OrderController');

// 导入JWT拦截中间件
const checkTokenMiddleware = require('../../middleware/checkTokenMiddleware')

//用户提交订单
router.post('/order/submit', checkTokenMiddleware, userSubmitOrder)

// 用户确认付款
router.post('/order/pay', checkTokenMiddleware, userPayOrder)

// 返回用户的订单记录
router.get('/order/records/:userID', checkTokenMiddleware, userOrderRecords)

// 用户取消订单
router.post('/order/cancel', checkTokenMiddleware, userCancelOrder)

// 用户确认出行
router.post('/order/confirm/:orderID', checkTokenMiddleware, userConfirmTravel)

module.exports = router